package com.easy.controller;
import com.easy.bean.User;
import com.easy.service.IShoppingLoginService;
import com.easy.util.LayData;
import com.easy.util.SYS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

import static com.easy.util.SYS.getLoginUserID;

@Controller
@RequestMapping("shopping")
public class ShoppingController {
    @Autowired
    IShoppingLoginService loginService;

    @RequestMapping("dologin")
    @ResponseBody
    public String shoppingLogin(User user, HttpSession session){
        String result=loginService.dologin(user);
        //执行登录业务
        if(result.equals("true")){
            session.setAttribute(SYS.SHOPPING_LOGIN_USER,user);
            return "success";
        }else if(result.equals("freeze")){
            return "freeze";
        }
        return "fail";
    }



//    @RequestMapping("system/dologin")
//    public String systemLogin(){
//        return "success";
//    }

}
